<template>
  <div>
    <van-swipe @change="onChange">
      <van-swipe-item v-for="item in imgList" :key="item">
        <img :src="item" alt="">
      </van-swipe-item>
  
      <template #indicator>
        <div class="custom-indicator">{{ current + 1 }}/4</div>
      </template>
    </van-swipe>
  </div>
</template>

<script>
export default {
  props: ['imgList'],
  data() {
    return {
      current: 0, // 当前轮播图索引
    }
  },
  methods: {
    onChange(index) {
      //轮播图
      this.current = index;
    },
  }
}
</script>
<style lang="less" scoped>
.custom-indicator {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 2px 5px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.1);
}
</style>